<template>
    <div class="big">
        <el-button  icon="el-icon-arrow-left" @click="back"></el-button>
        <div class="rotate">
            <div id="main"></div>
        </div>
    </div>
</template>

<script>
export default {
    data(){
        return {
            
        }
    },
    mounted(){
        var echarts=this.$root.echarts
        var myChart = echarts.init(document.getElementById('main'));
        
        var res=sessionStorage.getItem('numList');
        let numList = JSON.parse(res);
        let codeList = numList.codeList;
        let saveList = numList.saveList;
        
        myChart.setOption({
            title: {
            text: '现存量',
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        legend: {
            data: ['现存量']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'value',
            boundaryGap: [0, 0.01]
        },
        yAxis: {
            type: 'category',
            data: codeList
        },
        series: [
            {
                name: '',
                type: 'bar',
                data:saveList
            }
        ]
        });
    },
    methods:{
        back(){
            this.$router.push('/Sale');
            sessionStorage.setItem("numList",'')
        }
    }
}
</script>

<style>
.big{
    width: 100vw;
    height: 100vh;
    overflow: scroll;
}
.rotate{
    width: 100%;
    height:95%; 
}
#main{
    width: 100%;
    height:100%;
}

</style>
